package com.cqq.print.business.service.impl;


import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cqq.print.business.dao.PTitleDao;
import com.cqq.print.business.dao.domain.PTitle;
import com.cqq.print.business.service.PTitleService;
import com.cqq.print.business.service.bean.PTitleBean;


/**
 * @author CHENQQ
 * @date 2015-07-01
 */


@Service(value="pTitleService")
public class PTitleServiceImpl implements PTitleService{

             @Autowired
             private PTitleDao pTitleDao;
             
			
			public int insertSelective(PTitleBean bean) {
				if(bean==null)
					return 0;
				PTitle pTitle = new PTitle();
				BeanUtils.copyProperties(bean, pTitle);
				return pTitleDao.insertSelective(pTitle);
			}

			
			public int deleteByPrimaryKey(Integer id) {
				return pTitleDao.deleteByPrimaryKey(id);
			}

			
			public PTitleBean selectByPrimaryKey(Integer id) {
				PTitle pTitle = pTitleDao.selectByPrimaryKey(id);
				if(pTitle==null)
					return null;
				PTitleBean bean = new PTitleBean();
				BeanUtils.copyProperties(pTitle,bean);
				return bean;
			}

			
			public int updateByPrimaryKeySelective(PTitleBean bean) {
				if(bean==null||bean.getId()==null||bean.getId()<1)
					return 0;
				PTitle pTitle = new PTitle();
				BeanUtils.copyProperties(bean, pTitle);
				return pTitleDao.updateByPrimaryKeySelective(pTitle);
			}

}